<?php

/**
 * The view controller will be instantiated only if it exists. It has to
 * follow the [Modulename][Viewname]ViewController naming convention to be
 * recognized by the FrontController. It also has to implement the
 * IViewController interface.
 *
 * If a view controller is found for the requested view, the front controller
 * will not call the View::render() method but instead let the view controller
 * handle that call.
 */
class IndexViewController implements IViewController
{
    /**
     * Handles the request.
     *
     * @param Request $request
     * @param Response $response
     * @param View $view
     */
    public function handleRequest(Request $request, Response $response, View $view)
    {
        // When using a view controller, the view has to be rendered "actively".
        $view->render();
    }
}